package com.monitor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.monitor.entity.ErpWarehouse;

/**
 * <p>
 * 仓库物料 数量统计表 Mapper 接口
 * </p>
 *
 * @author LX
 * @since 2018-09-09
 */
public interface ErpWarehouseMapper extends BaseMapper<ErpWarehouse> {
	@Select("SELECT * FROM erp_warehouse WHERE warehouse_id=#{ware.warehouseId} AND customer_id=#{ware.customerId} AND materiel_name=#{ware.materielName} AND materiel_brand=#{ware.materielBrand} AND materiel_Specifications=#{ware.materielSpecifications} AND materiel_model=#{ware.materielModel} AND materiel_place=#{ware.materielPlace} AND materiel_state=#{ware.materielState} AND materiel_unit=#{ware.materielUnit}")
	public ErpWarehouse selectWareHouse(@Param("ware")ErpWarehouse ware);
	
	@Select("SELECT * from erp_warehouse w where w.materiel_name=#{name} and w.materiel_brand=#{brand} and w.materiel_specifications=#{specifications} 	and w.materiel_model=#{model} and w.materiel_place=#{place} and w.materiel_state=#{state} and w.materiel_unit=#{unit} 	and w.warehouse_id IN ( ${WarId} )")
	public List<ErpWarehouse> selectByWareIds(@Param("name")String name,@Param("brand")String brand,@Param("specifications")String specifications,@Param("model")String model,@Param("place")String place,@Param("state")String state,@Param("unit")String unit,@Param("WarId")String WarId);

	@Select("SELECT * FROM erp_warehouse WHERE 1=1 AND warehouse_id=#{wareId} ${sql}")
	public List<ErpWarehouse> selectByWareIdAndName(@Param("wareId")int wareId,@Param("sql")String sql);
	
	@Select("SELECT distinct  * FROM erp_warehouse WHERE  materiel_name=#{ware.materielName} AND materiel_brand=#{ware.materielBrand} AND materiel_Specifications=#{ware.materielSpecifications} AND materiel_model=#{ware.materielModel} AND materiel_place=#{ware.materielPlace} AND materiel_state=#{ware.materielState} AND materiel_unit=#{ware.materielUnit}")
	public ErpWarehouse selectWareHouse1(@Param("ware")ErpWarehouse ware);
}
